package com.hup.htts.config;

import com.hup.htts.model.MainConfig;
import com.hup.htts.service.GlobalKeyService;
import com.hup.utils.commons.start.AppIcon;
import com.hup.utils.commons.start.SimpleExitHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author hugan
 * @date 2021/9/14
 */
@Configuration
public class BeanConfig {

    public static final String GLOBAL_KEY_SERVICE = "globalKeyService";

    @Bean
    public AppIcon appIcon() {
        return new AppIcon("/img/app_tray.png");
    }

    @Bean
    public MainConfig mainConfig() {
        return new MainConfig().loadFromFile();
    }

    @Bean
    public SimpleExitHandler exitHandler() {
        return new SimpleExitHandler();
    }

    @Bean(name = GLOBAL_KEY_SERVICE)
    public GlobalKeyService globalKeyService(MainConfig mainConfig) {
        return new GlobalKeyService(mainConfig);
    }

}
